<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core" lang="pt-br">

<f:view>
	<h:panelGrid columns="2">
		<h:outputText value="Plano de Saúde" />
		<h:selectOneMenu value="#{medicoManager.planoSaude.id}" label="Plano de Saude" id="plano_saude">
			<f:selectItem itemLabel="- Selecione -" />
			<f:selectItems value="#{medicoManager.listPlanoSaude}" var="ps" itemLabel="#{ps.nomePlanoSaude}" itemValue="#{ps.id}"/>
		</h:selectOneMenu>
		
	</h:panelGrid>
	
	<p:commandButton value="Adicionar" action="#{medicoManager.addPlanoSaude}" update=":form:tab:panel_ps"/>
	
	<h:panelGroup id="panel_ps">
		<p:dataTable value="#{medicoManager.medico.planosSaude}" var="ps">
			<p:column headerText="Plano de Saúde">
				<h:outputText value="#{ps.nomePlanoSaude}" />
			</p:column>
			<p:column headerText="Ação">
				<p:commandButton value="Remover" action="#{medicoManager.removePlanoSaude}" update=":form:tab:panel_ps">
					<f:setPropertyActionListener target="#{medicoManager.planoSaude}" value="#{ps}" />
				</p:commandButton>
			</p:column>
		</p:dataTable>
	</h:panelGroup>
</f:view>
</html>